ARMADEUS_BASE_DIR=../../../git-armadeus
include $(ARMADEUS_BASE_DIR)/Makefile.in

ifeq ($(TARGET),)
        ROOT_DIR:=$(ARMADEUS_ROOTFS_DIR)
        CC:=$(ARMADEUS_TOOLCHAIN_PATH)/arm-linux-gcc
        DEFINES="-DTARGET"
        CFLAGS:=$(shell STAGING_DIR=$(ARMADEUS_STAGING_DIR) sh $(ARMADEUS_SDL_DIR)/sdl-config --cflags)
        LIBS:=$(shell STAGING_DIR=$(ARMADEUS_STAGING_DIR) sh $(ARMADEUS_SDL_DIR)/sdl-config --libs) -lSDL_image -lSDL_ttf -lSDL_mixer
else
        ROOT_DIR:="/"
        CFLAGS=`/usr/bin/sdl-config --cflags`
        LIBS=`/usr/bin/sdl-config --libs` -lSDL_Image -lSDL_ttf -lSDL_mixer
        CC=gcc
        DEFINES="-DHOST"
endif

# Armadeus board
ARM_ADDR=192.168.0.10
HOST_ADDR=192.168.0.1
GDB_PORT=2345

TFTPBOOT_DIR:=/tftpboot
ARM_DIR=/home

CFLAGS+="-g"

EXEC_NAME = elder_gui
SRC= $(wildcard *.c)
OBJ= $(SRC:.c=.o)

default: $(EXEC_NAME)

all: $(EXEC_NAME)
	cp $(EXEC_NAME) $(TFTPBOOT_DIR)

$(EXEC_NAME): $(OBJ)
	$(CC) $(LIBS) -o $@ $^ $(LDFLAGS)	

%.o: %.c
	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $^

install:
	scp $(EXEC_NAME) root@$(ARM_ADDR):$(ARM_DIR)
	
clean: 
	rm -rf *.o
	rm -f $(EXEC_NAME)

